import fetch from 'common/src/utils/fetch';
import baseUrl from './env';
import UTILS from "common/src/utils/utils";
import {
  param
} from 'common/src/utils';
import axios from 'axios';
const BASER_SERV_URL = '/api/baseresservice';

// 查询国际会议申请列表
function getApplyList() {
  return fetch({
    url: `${baseUrl}/pgIntlConference/getApplyList`,
    method: 'get'
  });
}

// 查询国际会议申请详情
function getConferenceDetails(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConference/getConferenceDetails?id=` + data,
    method: 'get',
    data
  });
}

// 获取学生信息
function getStudentInfo(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConference/getStudentInfo`,
    method: 'Post',
    data
  });
}

// 获取英文名称
function getEnglishName(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConference/getEnglishName`,
    method: 'Post',
    data
  });
}

// 获取会议信息
function getConferenceByParam(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConference/getConferenceByParam`,
    method: 'Post',
    data
  });
}

// 新增申请
function addApply(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConference/addApply`,
    method: 'Post',
    data
  });
}

// 修改申请
function editApply(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConference/editApply`,
    method: 'Post',
    data
  });
}

// 删除申请
function deleteBatchList(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConference/deleteBatchList`,
    method: 'Post',
    data
  });
}

// 获取报销详情
function getReimbursementDetails(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConferenceReimburse/getReimbursementDetails?id=` + data,
    method: 'get',
    data
  });
}

// 新增回国报销
function addReimbursement(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConference/addReimbursement`,
    method: 'Post',
    data
  });
}

// 修改回国报销
function editReimbursement(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConference/editReimbursement`,
    method: 'Post',
    data
  });
}

// 申请撤销
function approveRevoke(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConference/approveRevoke`,
    method: 'Post',
    data
  });
}

// 报销撤销
function revRevoke(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConferenceReimburse/approveRevoke`,
    method: 'Post',
    data
  });
}

// 下载资助函
function exportSubsidize(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConference/exportSubsidize?id=` + data,
    method: 'get',
    responseType: 'blob',
    data
  }).then(res => {
    UTILS.downloadFile(res, '资助函.doc', 'application/msword;charset=utf-8');
  });
}

// 总结模板下载
function downloadSummaryTemplate() {
  return fetch({
    url: `${baseUrl}/pgIntlConference/downloadSummaryTemplate`,
    method: 'get',
    responseType: 'blob',
  }).then(res => {
    UTILS.downloadFile(res, '总结模板.doc', 'application/msword;charset=utf-8');
  });
}

// 获取学生是否有不合格课程
function getTip() {
  return fetch({
    url: `${baseUrl}/pgIntlConference/getTip`,
    method: 'get'
  });
}

// 判断是否可申请时间
function getApplySwitch(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConference/getApplySwitch`,
    method: 'get'
  });
}

// 获取目录中学院
function getDirectoryFaculty() {
  return fetch({
    url: `${baseUrl}/pgIntlConference/getDirectoryFaculty`,
    method: 'get'
  });
}

// 出国经费历史信息
function queryHistories(data) {
  return fetch({
    url: `${baseUrl}/pgOverseasExchangeApply/queryHistories`,
    method: 'Post',
    data
  });
}

// 获取会议等级
function getLevel(data) {
  return fetch({
    url: `${baseUrl}/pgIntlConference/getLevel`,
    method: 'Post',
    data
  });
}

export default {
  'getApplyList': getApplyList,
  'getConferenceDetails': getConferenceDetails,
  'getStudentInfo': getStudentInfo,
  'getEnglishName': getEnglishName,
  'getConferenceByParam': getConferenceByParam,
  'addApply': addApply,
  'editApply': editApply,
  'deleteBatchList': deleteBatchList,
  'addReimbursement': addReimbursement,
  'getReimbursementDetails': getReimbursementDetails,
  'editReimbursement': editReimbursement,
  'approveRevoke': approveRevoke,
  'revRevoke': revRevoke,
  'exportSubsidize': exportSubsidize,
  'downloadSummaryTemplate': downloadSummaryTemplate,
  'getTip': getTip,
  'getApplySwitch': getApplySwitch,
  'getDirectoryFaculty': getDirectoryFaculty,
  'queryHistories': queryHistories,
  'getLevel': getLevel

};
